using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace CubicFWNet.Data.Models.Mapping
{
    public class CustomerMap : EntityTypeConfiguration<Customer>
    {
        public CustomerMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(128);

            this.Property(t => t.ShortName)
                .HasMaxLength(64);

            this.Property(t => t.Address)
                .HasMaxLength(256);

            this.Property(t => t.Corporation)
                .HasMaxLength(64);

            this.Property(t => t.Product)
                .HasMaxLength(512);

            this.Property(t => t.Range)
                .HasMaxLength(1024);

            this.Property(t => t.UserName)
               .HasMaxLength(64);

            this.Property(t => t.AccountPeriod)
                .HasMaxLength(1024);

            this.Property(t => t.BillingFlow)
                .HasMaxLength(1024);

            this.Property(t => t.StatementDate)
                .HasMaxLength(1024);

            this.Property(t => t.StatementCount)
                .HasMaxLength(1024);

            this.Property(t => t.CreatorName)
                .HasMaxLength(64);

            // Table & Column Mappings
            this.ToTable("Customer");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.ShortName).HasColumnName("ShortName");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.Corporation).HasColumnName("Corporation");
            this.Property(t => t.Product).HasColumnName("Product");
            this.Property(t => t.Yield).HasColumnName("Yield");
            this.Property(t => t.Market).HasColumnName("Market");
            this.Property(t => t.Range).HasColumnName("Range");
            this.Property(t => t.AccountPeriod).HasColumnName("AccountPeriod");
            this.Property(t => t.BillingFlow).HasColumnName("BillingFlow");
            this.Property(t => t.StatementDate).HasColumnName("StatementDate");
            this.Property(t => t.StatementCount).HasColumnName("StatementCount");
            this.Property(t => t.UserId).HasColumnName("UserID");
            this.Property(t => t.CreatorId).HasColumnName("CreatorID");
            this.Property(t => t.CreatorName).HasColumnName("CreatorName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.Principal).HasColumnName("Principal");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Memo).HasColumnName("Memo");
            this.Property(t => t.Explain).HasColumnName("Explain");

        }
    }
}
